﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Business_Booking_ImageUpload : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (IsValid)
        { 
            //文件名
            string filename = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(InputFile1.FileName);
            //保存文件路径
            string filefullname = System.IO.Path.Combine(Request.PhysicalApplicationPath + "\\Upload", filename);
            //上传文件
            InputFile1.MoveTo(filefullname, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);
            //显示讯息
            double size = Math.Round(InputFile1.ContentLength / 1024F, 2);
            Label1.Text = string.Format("来源:{0} ({1}kb)<br/>上传文件名称：{2}。",InputFile1.FileName,size,filename);

            //image1.Src = Server.MapPath(filefullname.Replace(@"\\",@"\"));
            image1.Src = "../../Upload/" + filename;

            Session["ImagePath"] = image1.Src;
            //Response.Write(image1.Src);
        }
    }
}
